{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "a6160bec",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: joblib in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (1.0.1)\n",
      "Collecting lightgbm\n",
      "  Downloading lightgbm-3.3.1-py3-none-manylinux1_x86_64.whl (2.0 MB)\n",
      "\u001b[K     |████████████████████████████████| 2.0 MB 8.5 MB/s eta 0:00:01\n",
      "\u001b[?25hRequirement already satisfied: scikit-learn!=0.22.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from lightgbm) (0.24.1)\n",
      "Requirement already satisfied: wheel in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from lightgbm) (0.36.2)\n",
      "Requirement already satisfied: scipy in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from lightgbm) (1.5.3)\n",
      "Requirement already satisfied: numpy in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from lightgbm) (1.19.5)\n",
      "Requirement already satisfied: threadpoolctl>=2.0.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from scikit-learn!=0.22.0->lightgbm) (2.1.0)\n",
      "Installing collected packages: lightgbm\n",
      "Successfully installed lightgbm-3.3.1\n",
      "\u001b[33mWARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.\n",
      "You should consider upgrading via the '/home/ec2-user/anaconda3/envs/python3/bin/python -m pip install --upgrade pip' command.\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "!pip install joblib lightgbm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "e673299e",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "from flask import Flask, render_template, request, redirect, url_for, jsonify\n",
    "from sklearn.feature_extraction.text import TfidfVectorizer\n",
    "from sklearn.multiclass import *\n",
    "from sklearn.svm import *\n",
    "import pandas\n",
    "import joblib\n",
    "from sklearn import metrics\n",
    "from sklearn.metrics import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "b512e552",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pandas.read_csv('../all_saved_train.csv', encoding='latin-1')\n",
    "data.columns=[\"v1\",\"v2\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "6be4b44b",
   "metadata": {},
   "outputs": [],
   "source": [
    "Vectorizer = TfidfVectorizer()\n",
    "vectorize_text = Vectorizer.fit_transform(data.v2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "b5b4312e",
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train, y_train = vectorize_text[:180000], data.v1[:180000]\n",
    "X_test, y_test = vectorize_text[180000:], data.v1[180000:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "e99d348c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Starting training...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages/lightgbm/sklearn.py:726: UserWarning: 'early_stopping_rounds' argument is deprecated and will be removed in a future release of LightGBM. Pass 'early_stopping()' callback via 'callbacks' argument instead.\n",
      "  _log_warning(\"'early_stopping_rounds' argument is deprecated and will be removed in a future release of LightGBM. \"\n",
      "/home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages/lightgbm/sklearn.py:736: UserWarning: 'verbose' argument is deprecated and will be removed in a future release of LightGBM. Pass 'log_evaluation()' callback via 'callbacks' argument instead.\n",
      "  _log_warning(\"'verbose' argument is deprecated and will be removed in a future release of LightGBM. \"\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1]\ttraining's multi_logloss: 2.64405\tvalid_0's multi_logloss: 2.74887\n",
      "[2]\ttraining's multi_logloss: 2.49882\tvalid_0's multi_logloss: 2.59345\n",
      "[3]\ttraining's multi_logloss: 2.39231\tvalid_0's multi_logloss: 2.47875\n",
      "[4]\ttraining's multi_logloss: 2.30708\tvalid_0's multi_logloss: 2.38695\n",
      "[5]\ttraining's multi_logloss: 2.23658\tvalid_0's multi_logloss: 2.3108\n",
      "[6]\ttraining's multi_logloss: 2.17671\tvalid_0's multi_logloss: 2.24762\n",
      "[7]\ttraining's multi_logloss: 2.12418\tvalid_0's multi_logloss: 2.19156\n",
      "[8]\ttraining's multi_logloss: 2.07706\tvalid_0's multi_logloss: 2.14253\n",
      "[9]\ttraining's multi_logloss: 2.03519\tvalid_0's multi_logloss: 2.09947\n",
      "[10]\ttraining's multi_logloss: 1.99682\tvalid_0's multi_logloss: 2.05955\n",
      "[11]\ttraining's multi_logloss: 1.96214\tvalid_0's multi_logloss: 2.02331\n",
      "[12]\ttraining's multi_logloss: 1.92868\tvalid_0's multi_logloss: 1.99022\n",
      "[13]\ttraining's multi_logloss: 1.89851\tvalid_0's multi_logloss: 1.95987\n",
      "[14]\ttraining's multi_logloss: 1.87076\tvalid_0's multi_logloss: 1.93227\n",
      "[15]\ttraining's multi_logloss: 1.84349\tvalid_0's multi_logloss: 1.90525\n",
      "[16]\ttraining's multi_logloss: 1.81908\tvalid_0's multi_logloss: 1.88149\n",
      "[17]\ttraining's multi_logloss: 1.79569\tvalid_0's multi_logloss: 1.85759\n",
      "[18]\ttraining's multi_logloss: 1.77436\tvalid_0's multi_logloss: 1.83704\n",
      "[19]\ttraining's multi_logloss: 1.7535\tvalid_0's multi_logloss: 1.8178\n",
      "[20]\ttraining's multi_logloss: 1.734\tvalid_0's multi_logloss: 1.7999\n",
      "[21]\ttraining's multi_logloss: 1.71513\tvalid_0's multi_logloss: 1.78136\n",
      "[22]\ttraining's multi_logloss: 1.69681\tvalid_0's multi_logloss: 1.7637\n",
      "[23]\ttraining's multi_logloss: 1.67934\tvalid_0's multi_logloss: 1.74847\n",
      "[24]\ttraining's multi_logloss: 1.66238\tvalid_0's multi_logloss: 1.73204\n",
      "[25]\ttraining's multi_logloss: 1.64607\tvalid_0's multi_logloss: 1.71546\n",
      "[26]\ttraining's multi_logloss: 1.63124\tvalid_0's multi_logloss: 1.70314\n",
      "[27]\ttraining's multi_logloss: 1.61694\tvalid_0's multi_logloss: 1.69041\n",
      "[28]\ttraining's multi_logloss: 1.60337\tvalid_0's multi_logloss: 1.67978\n",
      "[29]\ttraining's multi_logloss: 1.59004\tvalid_0's multi_logloss: 1.66761\n",
      "[30]\ttraining's multi_logloss: 1.57695\tvalid_0's multi_logloss: 1.65743\n",
      "[31]\ttraining's multi_logloss: 1.56409\tvalid_0's multi_logloss: 1.64618\n",
      "[32]\ttraining's multi_logloss: 1.55217\tvalid_0's multi_logloss: 1.63632\n",
      "[33]\ttraining's multi_logloss: 1.53986\tvalid_0's multi_logloss: 1.62644\n",
      "[34]\ttraining's multi_logloss: 1.52779\tvalid_0's multi_logloss: 1.61558\n",
      "[35]\ttraining's multi_logloss: 1.51669\tvalid_0's multi_logloss: 1.60677\n",
      "[36]\ttraining's multi_logloss: 1.50555\tvalid_0's multi_logloss: 1.59711\n",
      "[37]\ttraining's multi_logloss: 1.4946\tvalid_0's multi_logloss: 1.58841\n",
      "[38]\ttraining's multi_logloss: 1.48405\tvalid_0's multi_logloss: 1.58008\n",
      "[39]\ttraining's multi_logloss: 1.47412\tvalid_0's multi_logloss: 1.5721\n",
      "[40]\ttraining's multi_logloss: 1.46419\tvalid_0's multi_logloss: 1.56413\n",
      "[41]\ttraining's multi_logloss: 1.45439\tvalid_0's multi_logloss: 1.55666\n",
      "[42]\ttraining's multi_logloss: 1.4447\tvalid_0's multi_logloss: 1.54934\n",
      "[43]\ttraining's multi_logloss: 1.43514\tvalid_0's multi_logloss: 1.54199\n",
      "[44]\ttraining's multi_logloss: 1.42593\tvalid_0's multi_logloss: 1.53411\n",
      "[45]\ttraining's multi_logloss: 1.41675\tvalid_0's multi_logloss: 1.52609\n",
      "[46]\ttraining's multi_logloss: 1.40786\tvalid_0's multi_logloss: 1.51967\n",
      "[47]\ttraining's multi_logloss: 1.3991\tvalid_0's multi_logloss: 1.51251\n",
      "[48]\ttraining's multi_logloss: 1.39087\tvalid_0's multi_logloss: 1.50658\n",
      "[49]\ttraining's multi_logloss: 1.38286\tvalid_0's multi_logloss: 1.50077\n",
      "[50]\ttraining's multi_logloss: 1.37465\tvalid_0's multi_logloss: 1.49476\n",
      "[51]\ttraining's multi_logloss: 1.36683\tvalid_0's multi_logloss: 1.4892\n",
      "[52]\ttraining's multi_logloss: 1.35902\tvalid_0's multi_logloss: 1.48345\n",
      "[53]\ttraining's multi_logloss: 1.35145\tvalid_0's multi_logloss: 1.47832\n",
      "[54]\ttraining's multi_logloss: 1.344\tvalid_0's multi_logloss: 1.47354\n",
      "[55]\ttraining's multi_logloss: 1.33672\tvalid_0's multi_logloss: 1.46905\n",
      "[56]\ttraining's multi_logloss: 1.32917\tvalid_0's multi_logloss: 1.4623\n",
      "[57]\ttraining's multi_logloss: 1.32202\tvalid_0's multi_logloss: 1.45806\n",
      "[58]\ttraining's multi_logloss: 1.31511\tvalid_0's multi_logloss: 1.45327\n",
      "[59]\ttraining's multi_logloss: 1.30817\tvalid_0's multi_logloss: 1.44815\n",
      "[60]\ttraining's multi_logloss: 1.30133\tvalid_0's multi_logloss: 1.4425\n",
      "[61]\ttraining's multi_logloss: 1.2949\tvalid_0's multi_logloss: 1.43839\n",
      "[62]\ttraining's multi_logloss: 1.28859\tvalid_0's multi_logloss: 1.4347\n",
      "[63]\ttraining's multi_logloss: 1.28208\tvalid_0's multi_logloss: 1.43026\n",
      "[64]\ttraining's multi_logloss: 1.27586\tvalid_0's multi_logloss: 1.42619\n",
      "[65]\ttraining's multi_logloss: 1.26955\tvalid_0's multi_logloss: 1.42123\n",
      "[66]\ttraining's multi_logloss: 1.26348\tvalid_0's multi_logloss: 1.41729\n",
      "[67]\ttraining's multi_logloss: 1.2576\tvalid_0's multi_logloss: 1.41381\n",
      "[68]\ttraining's multi_logloss: 1.25179\tvalid_0's multi_logloss: 1.40996\n",
      "[69]\ttraining's multi_logloss: 1.24598\tvalid_0's multi_logloss: 1.40634\n",
      "[70]\ttraining's multi_logloss: 1.24029\tvalid_0's multi_logloss: 1.40315\n",
      "[71]\ttraining's multi_logloss: 1.23468\tvalid_0's multi_logloss: 1.3992\n",
      "[72]\ttraining's multi_logloss: 1.22908\tvalid_0's multi_logloss: 1.39535\n",
      "[73]\ttraining's multi_logloss: 1.22376\tvalid_0's multi_logloss: 1.3924\n",
      "[74]\ttraining's multi_logloss: 1.21855\tvalid_0's multi_logloss: 1.38935\n",
      "[75]\ttraining's multi_logloss: 1.21335\tvalid_0's multi_logloss: 1.38617\n",
      "[76]\ttraining's multi_logloss: 1.20817\tvalid_0's multi_logloss: 1.38343\n",
      "[77]\ttraining's multi_logloss: 1.20306\tvalid_0's multi_logloss: 1.3802\n",
      "[78]\ttraining's multi_logloss: 1.198\tvalid_0's multi_logloss: 1.37729\n",
      "[79]\ttraining's multi_logloss: 1.19297\tvalid_0's multi_logloss: 1.37422\n",
      "[80]\ttraining's multi_logloss: 1.18802\tvalid_0's multi_logloss: 1.37153\n",
      "[81]\ttraining's multi_logloss: 1.18321\tvalid_0's multi_logloss: 1.36917\n",
      "[82]\ttraining's multi_logloss: 1.1785\tvalid_0's multi_logloss: 1.36677\n",
      "[83]\ttraining's multi_logloss: 1.17381\tvalid_0's multi_logloss: 1.36362\n",
      "[84]\ttraining's multi_logloss: 1.16915\tvalid_0's multi_logloss: 1.36047\n",
      "[85]\ttraining's multi_logloss: 1.16453\tvalid_0's multi_logloss: 1.35783\n",
      "[86]\ttraining's multi_logloss: 1.16006\tvalid_0's multi_logloss: 1.35516\n",
      "[87]\ttraining's multi_logloss: 1.15556\tvalid_0's multi_logloss: 1.35301\n",
      "[88]\ttraining's multi_logloss: 1.15108\tvalid_0's multi_logloss: 1.35026\n",
      "[89]\ttraining's multi_logloss: 1.14672\tvalid_0's multi_logloss: 1.34768\n",
      "[90]\ttraining's multi_logloss: 1.14243\tvalid_0's multi_logloss: 1.3449\n",
      "[91]\ttraining's multi_logloss: 1.13822\tvalid_0's multi_logloss: 1.34274\n",
      "[92]\ttraining's multi_logloss: 1.13398\tvalid_0's multi_logloss: 1.34068\n",
      "[93]\ttraining's multi_logloss: 1.12975\tvalid_0's multi_logloss: 1.33825\n",
      "[94]\ttraining's multi_logloss: 1.12565\tvalid_0's multi_logloss: 1.33577\n",
      "[95]\ttraining's multi_logloss: 1.12166\tvalid_0's multi_logloss: 1.3334\n",
      "[96]\ttraining's multi_logloss: 1.11769\tvalid_0's multi_logloss: 1.33108\n",
      "[97]\ttraining's multi_logloss: 1.1137\tvalid_0's multi_logloss: 1.32912\n",
      "[98]\ttraining's multi_logloss: 1.10983\tvalid_0's multi_logloss: 1.32703\n",
      "[99]\ttraining's multi_logloss: 1.106\tvalid_0's multi_logloss: 1.32524\n",
      "[100]\ttraining's multi_logloss: 1.10221\tvalid_0's multi_logloss: 1.3233\n",
      "[101]\ttraining's multi_logloss: 1.0985\tvalid_0's multi_logloss: 1.32169\n",
      "[102]\ttraining's multi_logloss: 1.09477\tvalid_0's multi_logloss: 1.31965\n",
      "[103]\ttraining's multi_logloss: 1.09112\tvalid_0's multi_logloss: 1.31807\n",
      "[104]\ttraining's multi_logloss: 1.08746\tvalid_0's multi_logloss: 1.31626\n",
      "[105]\ttraining's multi_logloss: 1.08384\tvalid_0's multi_logloss: 1.31448\n",
      "[106]\ttraining's multi_logloss: 1.08029\tvalid_0's multi_logloss: 1.31248\n",
      "[107]\ttraining's multi_logloss: 1.07673\tvalid_0's multi_logloss: 1.31109\n",
      "[108]\ttraining's multi_logloss: 1.0732\tvalid_0's multi_logloss: 1.30911\n",
      "[109]\ttraining's multi_logloss: 1.06977\tvalid_0's multi_logloss: 1.30754\n",
      "[110]\ttraining's multi_logloss: 1.06632\tvalid_0's multi_logloss: 1.30604\n",
      "[111]\ttraining's multi_logloss: 1.06295\tvalid_0's multi_logloss: 1.3043\n",
      "[112]\ttraining's multi_logloss: 1.05963\tvalid_0's multi_logloss: 1.30282\n",
      "[113]\ttraining's multi_logloss: 1.05633\tvalid_0's multi_logloss: 1.30184\n",
      "[114]\ttraining's multi_logloss: 1.05306\tvalid_0's multi_logloss: 1.29986\n",
      "[115]\ttraining's multi_logloss: 1.04983\tvalid_0's multi_logloss: 1.29805\n",
      "[116]\ttraining's multi_logloss: 1.04666\tvalid_0's multi_logloss: 1.29645\n",
      "[117]\ttraining's multi_logloss: 1.0435\tvalid_0's multi_logloss: 1.29511\n",
      "[118]\ttraining's multi_logloss: 1.04038\tvalid_0's multi_logloss: 1.29382\n",
      "[119]\ttraining's multi_logloss: 1.03725\tvalid_0's multi_logloss: 1.29258\n",
      "[120]\ttraining's multi_logloss: 1.03418\tvalid_0's multi_logloss: 1.29131\n",
      "[121]\ttraining's multi_logloss: 1.03115\tvalid_0's multi_logloss: 1.29007\n",
      "[122]\ttraining's multi_logloss: 1.0281\tvalid_0's multi_logloss: 1.28846\n",
      "[123]\ttraining's multi_logloss: 1.02511\tvalid_0's multi_logloss: 1.28711\n",
      "[124]\ttraining's multi_logloss: 1.0221\tvalid_0's multi_logloss: 1.28575\n",
      "[125]\ttraining's multi_logloss: 1.01915\tvalid_0's multi_logloss: 1.28432\n",
      "[126]\ttraining's multi_logloss: 1.01621\tvalid_0's multi_logloss: 1.28352\n",
      "[127]\ttraining's multi_logloss: 1.0133\tvalid_0's multi_logloss: 1.2823\n",
      "[128]\ttraining's multi_logloss: 1.01041\tvalid_0's multi_logloss: 1.28127\n",
      "[129]\ttraining's multi_logloss: 1.00757\tvalid_0's multi_logloss: 1.28019\n",
      "[130]\ttraining's multi_logloss: 1.0047\tvalid_0's multi_logloss: 1.27888\n",
      "[131]\ttraining's multi_logloss: 1.00188\tvalid_0's multi_logloss: 1.27788\n",
      "[132]\ttraining's multi_logloss: 0.999056\tvalid_0's multi_logloss: 1.27661\n",
      "[133]\ttraining's multi_logloss: 0.996297\tvalid_0's multi_logloss: 1.27573\n",
      "[134]\ttraining's multi_logloss: 0.993526\tvalid_0's multi_logloss: 1.27483\n",
      "[135]\ttraining's multi_logloss: 0.99079\tvalid_0's multi_logloss: 1.27405\n",
      "[136]\ttraining's multi_logloss: 0.988098\tvalid_0's multi_logloss: 1.27264\n",
      "[137]\ttraining's multi_logloss: 0.985404\tvalid_0's multi_logloss: 1.27188\n",
      "[138]\ttraining's multi_logloss: 0.982744\tvalid_0's multi_logloss: 1.27065\n",
      "[139]\ttraining's multi_logloss: 0.980147\tvalid_0's multi_logloss: 1.26973\n",
      "[140]\ttraining's multi_logloss: 0.977534\tvalid_0's multi_logloss: 1.26872\n",
      "[141]\ttraining's multi_logloss: 0.974954\tvalid_0's multi_logloss: 1.26774\n",
      "[142]\ttraining's multi_logloss: 0.972416\tvalid_0's multi_logloss: 1.26686\n",
      "[143]\ttraining's multi_logloss: 0.969923\tvalid_0's multi_logloss: 1.26583\n",
      "[144]\ttraining's multi_logloss: 0.967329\tvalid_0's multi_logloss: 1.26496\n",
      "[145]\ttraining's multi_logloss: 0.964796\tvalid_0's multi_logloss: 1.26415\n",
      "[146]\ttraining's multi_logloss: 0.962233\tvalid_0's multi_logloss: 1.2629\n",
      "[147]\ttraining's multi_logloss: 0.959754\tvalid_0's multi_logloss: 1.26207\n",
      "[148]\ttraining's multi_logloss: 0.957243\tvalid_0's multi_logloss: 1.26141\n",
      "[149]\ttraining's multi_logloss: 0.954811\tvalid_0's multi_logloss: 1.26017\n",
      "[150]\ttraining's multi_logloss: 0.952392\tvalid_0's multi_logloss: 1.25942\n",
      "[151]\ttraining's multi_logloss: 0.949966\tvalid_0's multi_logloss: 1.25845\n",
      "[152]\ttraining's multi_logloss: 0.947572\tvalid_0's multi_logloss: 1.2577\n",
      "[153]\ttraining's multi_logloss: 0.945183\tvalid_0's multi_logloss: 1.25704\n",
      "[154]\ttraining's multi_logloss: 0.942791\tvalid_0's multi_logloss: 1.25639\n",
      "[155]\ttraining's multi_logloss: 0.940375\tvalid_0's multi_logloss: 1.25563\n",
      "[156]\ttraining's multi_logloss: 0.938074\tvalid_0's multi_logloss: 1.25472\n",
      "[157]\ttraining's multi_logloss: 0.9358\tvalid_0's multi_logloss: 1.25397\n",
      "[158]\ttraining's multi_logloss: 0.933448\tvalid_0's multi_logloss: 1.25333\n",
      "[159]\ttraining's multi_logloss: 0.931157\tvalid_0's multi_logloss: 1.25263\n",
      "[160]\ttraining's multi_logloss: 0.928909\tvalid_0's multi_logloss: 1.25171\n",
      "[161]\ttraining's multi_logloss: 0.926642\tvalid_0's multi_logloss: 1.25065\n",
      "[162]\ttraining's multi_logloss: 0.9244\tvalid_0's multi_logloss: 1.24983\n",
      "[163]\ttraining's multi_logloss: 0.922168\tvalid_0's multi_logloss: 1.24907\n",
      "[164]\ttraining's multi_logloss: 0.919975\tvalid_0's multi_logloss: 1.24845\n",
      "[165]\ttraining's multi_logloss: 0.917744\tvalid_0's multi_logloss: 1.24773\n",
      "[166]\ttraining's multi_logloss: 0.915545\tvalid_0's multi_logloss: 1.24677\n",
      "[167]\ttraining's multi_logloss: 0.913399\tvalid_0's multi_logloss: 1.24615\n",
      "[168]\ttraining's multi_logloss: 0.911269\tvalid_0's multi_logloss: 1.24562\n",
      "[169]\ttraining's multi_logloss: 0.909089\tvalid_0's multi_logloss: 1.24492\n",
      "[170]\ttraining's multi_logloss: 0.906948\tvalid_0's multi_logloss: 1.24438\n",
      "[171]\ttraining's multi_logloss: 0.904838\tvalid_0's multi_logloss: 1.24387\n",
      "[172]\ttraining's multi_logloss: 0.902781\tvalid_0's multi_logloss: 1.24306\n",
      "[173]\ttraining's multi_logloss: 0.900705\tvalid_0's multi_logloss: 1.2426\n",
      "[174]\ttraining's multi_logloss: 0.898631\tvalid_0's multi_logloss: 1.24174\n",
      "[175]\ttraining's multi_logloss: 0.896554\tvalid_0's multi_logloss: 1.24089\n",
      "[176]\ttraining's multi_logloss: 0.894491\tvalid_0's multi_logloss: 1.24021\n",
      "[177]\ttraining's multi_logloss: 0.892478\tvalid_0's multi_logloss: 1.23953\n",
      "[178]\ttraining's multi_logloss: 0.890457\tvalid_0's multi_logloss: 1.23878\n",
      "[179]\ttraining's multi_logloss: 0.888424\tvalid_0's multi_logloss: 1.23804\n",
      "[180]\ttraining's multi_logloss: 0.886443\tvalid_0's multi_logloss: 1.23756\n",
      "[181]\ttraining's multi_logloss: 0.884468\tvalid_0's multi_logloss: 1.23715\n",
      "[182]\ttraining's multi_logloss: 0.882503\tvalid_0's multi_logloss: 1.23671\n",
      "[183]\ttraining's multi_logloss: 0.880538\tvalid_0's multi_logloss: 1.23636\n",
      "[184]\ttraining's multi_logloss: 0.878549\tvalid_0's multi_logloss: 1.23571\n",
      "[185]\ttraining's multi_logloss: 0.876576\tvalid_0's multi_logloss: 1.23506\n",
      "[186]\ttraining's multi_logloss: 0.874635\tvalid_0's multi_logloss: 1.23461\n",
      "[187]\ttraining's multi_logloss: 0.872694\tvalid_0's multi_logloss: 1.23401\n",
      "[188]\ttraining's multi_logloss: 0.870773\tvalid_0's multi_logloss: 1.23335\n",
      "[189]\ttraining's multi_logloss: 0.868863\tvalid_0's multi_logloss: 1.23291\n",
      "[190]\ttraining's multi_logloss: 0.866928\tvalid_0's multi_logloss: 1.23242\n",
      "[191]\ttraining's multi_logloss: 0.865024\tvalid_0's multi_logloss: 1.23178\n",
      "[192]\ttraining's multi_logloss: 0.863142\tvalid_0's multi_logloss: 1.23126\n",
      "[193]\ttraining's multi_logloss: 0.861296\tvalid_0's multi_logloss: 1.23077\n",
      "[194]\ttraining's multi_logloss: 0.859405\tvalid_0's multi_logloss: 1.23025\n",
      "[195]\ttraining's multi_logloss: 0.857511\tvalid_0's multi_logloss: 1.22983\n",
      "[196]\ttraining's multi_logloss: 0.855706\tvalid_0's multi_logloss: 1.22928\n",
      "[197]\ttraining's multi_logloss: 0.853857\tvalid_0's multi_logloss: 1.22876\n",
      "[198]\ttraining's multi_logloss: 0.852012\tvalid_0's multi_logloss: 1.22821\n",
      "[199]\ttraining's multi_logloss: 0.850211\tvalid_0's multi_logloss: 1.22776\n",
      "[200]\ttraining's multi_logloss: 0.84842\tvalid_0's multi_logloss: 1.22727\n",
      "[201]\ttraining's multi_logloss: 0.846617\tvalid_0's multi_logloss: 1.22687\n",
      "[202]\ttraining's multi_logloss: 0.844842\tvalid_0's multi_logloss: 1.22647\n",
      "[203]\ttraining's multi_logloss: 0.84305\tvalid_0's multi_logloss: 1.22593\n",
      "[204]\ttraining's multi_logloss: 0.841246\tvalid_0's multi_logloss: 1.22565\n",
      "[205]\ttraining's multi_logloss: 0.839466\tvalid_0's multi_logloss: 1.22523\n",
      "[206]\ttraining's multi_logloss: 0.837704\tvalid_0's multi_logloss: 1.22488\n",
      "[207]\ttraining's multi_logloss: 0.835912\tvalid_0's multi_logloss: 1.2244\n",
      "[208]\ttraining's multi_logloss: 0.834197\tvalid_0's multi_logloss: 1.22418\n",
      "[209]\ttraining's multi_logloss: 0.832464\tvalid_0's multi_logloss: 1.22372\n",
      "[210]\ttraining's multi_logloss: 0.830724\tvalid_0's multi_logloss: 1.22348\n",
      "[211]\ttraining's multi_logloss: 0.829043\tvalid_0's multi_logloss: 1.22301\n",
      "[212]\ttraining's multi_logloss: 0.827365\tvalid_0's multi_logloss: 1.22265\n",
      "[213]\ttraining's multi_logloss: 0.825643\tvalid_0's multi_logloss: 1.22205\n",
      "[214]\ttraining's multi_logloss: 0.823965\tvalid_0's multi_logloss: 1.22161\n",
      "[215]\ttraining's multi_logloss: 0.822268\tvalid_0's multi_logloss: 1.22133\n",
      "[216]\ttraining's multi_logloss: 0.820622\tvalid_0's multi_logloss: 1.22101\n",
      "[217]\ttraining's multi_logloss: 0.818961\tvalid_0's multi_logloss: 1.22051\n",
      "[218]\ttraining's multi_logloss: 0.817287\tvalid_0's multi_logloss: 1.22032\n",
      "[219]\ttraining's multi_logloss: 0.815643\tvalid_0's multi_logloss: 1.21991\n",
      "[220]\ttraining's multi_logloss: 0.81402\tvalid_0's multi_logloss: 1.21959\n",
      "[221]\ttraining's multi_logloss: 0.812423\tvalid_0's multi_logloss: 1.2191\n",
      "[222]\ttraining's multi_logloss: 0.810795\tvalid_0's multi_logloss: 1.21869\n",
      "[223]\ttraining's multi_logloss: 0.809172\tvalid_0's multi_logloss: 1.21834\n",
      "[224]\ttraining's multi_logloss: 0.807575\tvalid_0's multi_logloss: 1.21809\n",
      "[225]\ttraining's multi_logloss: 0.805967\tvalid_0's multi_logloss: 1.21782\n",
      "[226]\ttraining's multi_logloss: 0.804386\tvalid_0's multi_logloss: 1.21751\n",
      "[227]\ttraining's multi_logloss: 0.802778\tvalid_0's multi_logloss: 1.21712\n",
      "[228]\ttraining's multi_logloss: 0.801154\tvalid_0's multi_logloss: 1.21686\n",
      "[229]\ttraining's multi_logloss: 0.799581\tvalid_0's multi_logloss: 1.21647\n",
      "[230]\ttraining's multi_logloss: 0.798032\tvalid_0's multi_logloss: 1.21604\n",
      "[231]\ttraining's multi_logloss: 0.79646\tvalid_0's multi_logloss: 1.21581\n",
      "[232]\ttraining's multi_logloss: 0.794876\tvalid_0's multi_logloss: 1.21542\n",
      "[233]\ttraining's multi_logloss: 0.793342\tvalid_0's multi_logloss: 1.21521\n",
      "[234]\ttraining's multi_logloss: 0.791813\tvalid_0's multi_logloss: 1.21485\n",
      "[235]\ttraining's multi_logloss: 0.790275\tvalid_0's multi_logloss: 1.21466\n",
      "[236]\ttraining's multi_logloss: 0.788749\tvalid_0's multi_logloss: 1.21428\n",
      "[237]\ttraining's multi_logloss: 0.787203\tvalid_0's multi_logloss: 1.21407\n",
      "[238]\ttraining's multi_logloss: 0.785695\tvalid_0's multi_logloss: 1.21367\n",
      "[239]\ttraining's multi_logloss: 0.78416\tvalid_0's multi_logloss: 1.2134\n",
      "[240]\ttraining's multi_logloss: 0.782668\tvalid_0's multi_logloss: 1.21307\n",
      "[241]\ttraining's multi_logloss: 0.781186\tvalid_0's multi_logloss: 1.21288\n",
      "[242]\ttraining's multi_logloss: 0.779666\tvalid_0's multi_logloss: 1.21265\n",
      "[243]\ttraining's multi_logloss: 0.778217\tvalid_0's multi_logloss: 1.21242\n",
      "[244]\ttraining's multi_logloss: 0.776747\tvalid_0's multi_logloss: 1.21221\n",
      "[245]\ttraining's multi_logloss: 0.775276\tvalid_0's multi_logloss: 1.21185\n",
      "[246]\ttraining's multi_logloss: 0.773802\tvalid_0's multi_logloss: 1.21161\n",
      "[247]\ttraining's multi_logloss: 0.772342\tvalid_0's multi_logloss: 1.21118\n",
      "[248]\ttraining's multi_logloss: 0.770883\tvalid_0's multi_logloss: 1.21094\n",
      "[249]\ttraining's multi_logloss: 0.769426\tvalid_0's multi_logloss: 1.21085\n",
      "[250]\ttraining's multi_logloss: 0.767935\tvalid_0's multi_logloss: 1.21029\n",
      "[251]\ttraining's multi_logloss: 0.766459\tvalid_0's multi_logloss: 1.21\n",
      "[252]\ttraining's multi_logloss: 0.76499\tvalid_0's multi_logloss: 1.20983\n",
      "[253]\ttraining's multi_logloss: 0.763544\tvalid_0's multi_logloss: 1.20959\n",
      "[254]\ttraining's multi_logloss: 0.762125\tvalid_0's multi_logloss: 1.20946\n",
      "[255]\ttraining's multi_logloss: 0.76069\tvalid_0's multi_logloss: 1.20901\n",
      "[256]\ttraining's multi_logloss: 0.759301\tvalid_0's multi_logloss: 1.20887\n",
      "[257]\ttraining's multi_logloss: 0.757868\tvalid_0's multi_logloss: 1.20865\n",
      "[258]\ttraining's multi_logloss: 0.756464\tvalid_0's multi_logloss: 1.20861\n",
      "[259]\ttraining's multi_logloss: 0.755051\tvalid_0's multi_logloss: 1.20835\n",
      "[260]\ttraining's multi_logloss: 0.753671\tvalid_0's multi_logloss: 1.20793\n",
      "[261]\ttraining's multi_logloss: 0.752294\tvalid_0's multi_logloss: 1.20764\n",
      "[262]\ttraining's multi_logloss: 0.75092\tvalid_0's multi_logloss: 1.20744\n",
      "[263]\ttraining's multi_logloss: 0.749532\tvalid_0's multi_logloss: 1.2072\n",
      "[264]\ttraining's multi_logloss: 0.748153\tvalid_0's multi_logloss: 1.2071\n",
      "[265]\ttraining's multi_logloss: 0.74679\tvalid_0's multi_logloss: 1.20682\n",
      "[266]\ttraining's multi_logloss: 0.745445\tvalid_0's multi_logloss: 1.20676\n",
      "[267]\ttraining's multi_logloss: 0.744067\tvalid_0's multi_logloss: 1.20659\n",
      "[268]\ttraining's multi_logloss: 0.742742\tvalid_0's multi_logloss: 1.20631\n",
      "[269]\ttraining's multi_logloss: 0.741367\tvalid_0's multi_logloss: 1.20622\n",
      "[270]\ttraining's multi_logloss: 0.74003\tvalid_0's multi_logloss: 1.20606\n",
      "[271]\ttraining's multi_logloss: 0.738722\tvalid_0's multi_logloss: 1.20576\n",
      "[272]\ttraining's multi_logloss: 0.737384\tvalid_0's multi_logloss: 1.20554\n",
      "[273]\ttraining's multi_logloss: 0.736073\tvalid_0's multi_logloss: 1.20535\n",
      "[274]\ttraining's multi_logloss: 0.734729\tvalid_0's multi_logloss: 1.20502\n",
      "[275]\ttraining's multi_logloss: 0.733413\tvalid_0's multi_logloss: 1.20491\n",
      "[276]\ttraining's multi_logloss: 0.732117\tvalid_0's multi_logloss: 1.20477\n",
      "[277]\ttraining's multi_logloss: 0.730821\tvalid_0's multi_logloss: 1.20453\n",
      "[278]\ttraining's multi_logloss: 0.729532\tvalid_0's multi_logloss: 1.20426\n",
      "[279]\ttraining's multi_logloss: 0.728264\tvalid_0's multi_logloss: 1.20395\n",
      "[280]\ttraining's multi_logloss: 0.726978\tvalid_0's multi_logloss: 1.20371\n",
      "[281]\ttraining's multi_logloss: 0.72568\tvalid_0's multi_logloss: 1.20361\n",
      "[282]\ttraining's multi_logloss: 0.724409\tvalid_0's multi_logloss: 1.20332\n",
      "[283]\ttraining's multi_logloss: 0.723141\tvalid_0's multi_logloss: 1.2032\n",
      "[284]\ttraining's multi_logloss: 0.721855\tvalid_0's multi_logloss: 1.20292\n",
      "[285]\ttraining's multi_logloss: 0.720581\tvalid_0's multi_logloss: 1.20265\n",
      "[286]\ttraining's multi_logloss: 0.719271\tvalid_0's multi_logloss: 1.20236\n",
      "[287]\ttraining's multi_logloss: 0.718009\tvalid_0's multi_logloss: 1.20211\n",
      "[288]\ttraining's multi_logloss: 0.716751\tvalid_0's multi_logloss: 1.20198\n",
      "[289]\ttraining's multi_logloss: 0.715512\tvalid_0's multi_logloss: 1.20183\n",
      "[290]\ttraining's multi_logloss: 0.714264\tvalid_0's multi_logloss: 1.20165\n",
      "[291]\ttraining's multi_logloss: 0.71303\tvalid_0's multi_logloss: 1.20148\n",
      "[292]\ttraining's multi_logloss: 0.711785\tvalid_0's multi_logloss: 1.20141\n",
      "[293]\ttraining's multi_logloss: 0.710546\tvalid_0's multi_logloss: 1.20123\n",
      "[294]\ttraining's multi_logloss: 0.709326\tvalid_0's multi_logloss: 1.20117\n",
      "[295]\ttraining's multi_logloss: 0.708059\tvalid_0's multi_logloss: 1.20094\n",
      "[296]\ttraining's multi_logloss: 0.706872\tvalid_0's multi_logloss: 1.2008\n",
      "[297]\ttraining's multi_logloss: 0.705642\tvalid_0's multi_logloss: 1.20053\n",
      "[298]\ttraining's multi_logloss: 0.704411\tvalid_0's multi_logloss: 1.20036\n",
      "[299]\ttraining's multi_logloss: 0.703179\tvalid_0's multi_logloss: 1.20016\n",
      "[300]\ttraining's multi_logloss: 0.701951\tvalid_0's multi_logloss: 1.20007\n",
      "[301]\ttraining's multi_logloss: 0.700764\tvalid_0's multi_logloss: 1.19984\n",
      "[302]\ttraining's multi_logloss: 0.699547\tvalid_0's multi_logloss: 1.19969\n",
      "[303]\ttraining's multi_logloss: 0.698376\tvalid_0's multi_logloss: 1.19974\n",
      "[304]\ttraining's multi_logloss: 0.697186\tvalid_0's multi_logloss: 1.19942\n",
      "[305]\ttraining's multi_logloss: 0.695987\tvalid_0's multi_logloss: 1.19939\n",
      "[306]\ttraining's multi_logloss: 0.694792\tvalid_0's multi_logloss: 1.19924\n",
      "[307]\ttraining's multi_logloss: 0.693593\tvalid_0's multi_logloss: 1.19916\n",
      "[308]\ttraining's multi_logloss: 0.692441\tvalid_0's multi_logloss: 1.19906\n",
      "[309]\ttraining's multi_logloss: 0.69128\tvalid_0's multi_logloss: 1.19891\n",
      "[310]\ttraining's multi_logloss: 0.690085\tvalid_0's multi_logloss: 1.19878\n",
      "[311]\ttraining's multi_logloss: 0.688918\tvalid_0's multi_logloss: 1.19872\n",
      "[312]\ttraining's multi_logloss: 0.687751\tvalid_0's multi_logloss: 1.19873\n",
      "[313]\ttraining's multi_logloss: 0.686545\tvalid_0's multi_logloss: 1.19853\n",
      "[314]\ttraining's multi_logloss: 0.685403\tvalid_0's multi_logloss: 1.19834\n",
      "[315]\ttraining's multi_logloss: 0.684293\tvalid_0's multi_logloss: 1.19812\n",
      "[316]\ttraining's multi_logloss: 0.683162\tvalid_0's multi_logloss: 1.19793\n",
      "[317]\ttraining's multi_logloss: 0.682029\tvalid_0's multi_logloss: 1.19784\n",
      "[318]\ttraining's multi_logloss: 0.680878\tvalid_0's multi_logloss: 1.1977\n",
      "[319]\ttraining's multi_logloss: 0.679744\tvalid_0's multi_logloss: 1.19773\n",
      "[320]\ttraining's multi_logloss: 0.678599\tvalid_0's multi_logloss: 1.19764\n",
      "[321]\ttraining's multi_logloss: 0.677481\tvalid_0's multi_logloss: 1.19754\n",
      "[322]\ttraining's multi_logloss: 0.676352\tvalid_0's multi_logloss: 1.19751\n",
      "[323]\ttraining's multi_logloss: 0.675258\tvalid_0's multi_logloss: 1.19757\n",
      "[324]\ttraining's multi_logloss: 0.674143\tvalid_0's multi_logloss: 1.19745\n",
      "[325]\ttraining's multi_logloss: 0.673044\tvalid_0's multi_logloss: 1.19734\n",
      "[326]\ttraining's multi_logloss: 0.671919\tvalid_0's multi_logloss: 1.1973\n",
      "[327]\ttraining's multi_logloss: 0.670791\tvalid_0's multi_logloss: 1.19727\n",
      "[328]\ttraining's multi_logloss: 0.669677\tvalid_0's multi_logloss: 1.19734\n",
      "[329]\ttraining's multi_logloss: 0.668585\tvalid_0's multi_logloss: 1.1972\n",
      "[330]\ttraining's multi_logloss: 0.667482\tvalid_0's multi_logloss: 1.19714\n",
      "[331]\ttraining's multi_logloss: 0.666403\tvalid_0's multi_logloss: 1.19714\n",
      "[332]\ttraining's multi_logloss: 0.665321\tvalid_0's multi_logloss: 1.19708\n",
      "[333]\ttraining's multi_logloss: 0.664189\tvalid_0's multi_logloss: 1.19707\n",
      "[334]\ttraining's multi_logloss: 0.663106\tvalid_0's multi_logloss: 1.19707\n",
      "[335]\ttraining's multi_logloss: 0.66203\tvalid_0's multi_logloss: 1.19695\n",
      "[336]\ttraining's multi_logloss: 0.66094\tvalid_0's multi_logloss: 1.19681\n",
      "[337]\ttraining's multi_logloss: 0.659833\tvalid_0's multi_logloss: 1.19676\n",
      "[338]\ttraining's multi_logloss: 0.658753\tvalid_0's multi_logloss: 1.19665\n",
      "[339]\ttraining's multi_logloss: 0.657666\tvalid_0's multi_logloss: 1.19661\n",
      "[340]\ttraining's multi_logloss: 0.656561\tvalid_0's multi_logloss: 1.19647\n",
      "[341]\ttraining's multi_logloss: 0.655535\tvalid_0's multi_logloss: 1.19645\n",
      "[342]\ttraining's multi_logloss: 0.654509\tvalid_0's multi_logloss: 1.19634\n",
      "[343]\ttraining's multi_logloss: 0.653448\tvalid_0's multi_logloss: 1.19624\n",
      "[344]\ttraining's multi_logloss: 0.652392\tvalid_0's multi_logloss: 1.19609\n",
      "[345]\ttraining's multi_logloss: 0.65131\tvalid_0's multi_logloss: 1.19593\n",
      "[346]\ttraining's multi_logloss: 0.650255\tvalid_0's multi_logloss: 1.19589\n",
      "[347]\ttraining's multi_logloss: 0.649231\tvalid_0's multi_logloss: 1.19591\n",
      "[348]\ttraining's multi_logloss: 0.648174\tvalid_0's multi_logloss: 1.19586\n",
      "[349]\ttraining's multi_logloss: 0.647121\tvalid_0's multi_logloss: 1.1958\n",
      "[350]\ttraining's multi_logloss: 0.646107\tvalid_0's multi_logloss: 1.1958\n",
      "[351]\ttraining's multi_logloss: 0.645077\tvalid_0's multi_logloss: 1.19578\n",
      "[352]\ttraining's multi_logloss: 0.644025\tvalid_0's multi_logloss: 1.1956\n",
      "[353]\ttraining's multi_logloss: 0.643006\tvalid_0's multi_logloss: 1.19558\n",
      "[354]\ttraining's multi_logloss: 0.641964\tvalid_0's multi_logloss: 1.1955\n",
      "[355]\ttraining's multi_logloss: 0.640954\tvalid_0's multi_logloss: 1.19541\n",
      "[356]\ttraining's multi_logloss: 0.639949\tvalid_0's multi_logloss: 1.19535\n",
      "[357]\ttraining's multi_logloss: 0.63895\tvalid_0's multi_logloss: 1.19527\n",
      "[358]\ttraining's multi_logloss: 0.637958\tvalid_0's multi_logloss: 1.19526\n",
      "[359]\ttraining's multi_logloss: 0.636927\tvalid_0's multi_logloss: 1.19515\n",
      "[360]\ttraining's multi_logloss: 0.635925\tvalid_0's multi_logloss: 1.19516\n",
      "[361]\ttraining's multi_logloss: 0.634915\tvalid_0's multi_logloss: 1.19499\n",
      "[362]\ttraining's multi_logloss: 0.633894\tvalid_0's multi_logloss: 1.19486\n",
      "[363]\ttraining's multi_logloss: 0.632893\tvalid_0's multi_logloss: 1.19473\n",
      "[364]\ttraining's multi_logloss: 0.631889\tvalid_0's multi_logloss: 1.19469\n",
      "[365]\ttraining's multi_logloss: 0.630903\tvalid_0's multi_logloss: 1.1945\n",
      "[366]\ttraining's multi_logloss: 0.629936\tvalid_0's multi_logloss: 1.19433\n",
      "[367]\ttraining's multi_logloss: 0.628955\tvalid_0's multi_logloss: 1.19407\n",
      "[368]\ttraining's multi_logloss: 0.627981\tvalid_0's multi_logloss: 1.19407\n",
      "[369]\ttraining's multi_logloss: 0.627008\tvalid_0's multi_logloss: 1.19403\n",
      "[370]\ttraining's multi_logloss: 0.626029\tvalid_0's multi_logloss: 1.19392\n",
      "[371]\ttraining's multi_logloss: 0.625026\tvalid_0's multi_logloss: 1.19402\n",
      "[372]\ttraining's multi_logloss: 0.624077\tvalid_0's multi_logloss: 1.19394\n",
      "[373]\ttraining's multi_logloss: 0.62311\tvalid_0's multi_logloss: 1.19395\n",
      "[374]\ttraining's multi_logloss: 0.622124\tvalid_0's multi_logloss: 1.19394\n",
      "[375]\ttraining's multi_logloss: 0.621177\tvalid_0's multi_logloss: 1.19371\n",
      "[376]\ttraining's multi_logloss: 0.620191\tvalid_0's multi_logloss: 1.19366\n",
      "[377]\ttraining's multi_logloss: 0.619199\tvalid_0's multi_logloss: 1.19371\n",
      "[378]\ttraining's multi_logloss: 0.618264\tvalid_0's multi_logloss: 1.19367\n",
      "[379]\ttraining's multi_logloss: 0.617316\tvalid_0's multi_logloss: 1.19361\n",
      "[380]\ttraining's multi_logloss: 0.616373\tvalid_0's multi_logloss: 1.19346\n",
      "[381]\ttraining's multi_logloss: 0.615421\tvalid_0's multi_logloss: 1.19337\n",
      "[382]\ttraining's multi_logloss: 0.614484\tvalid_0's multi_logloss: 1.19316\n",
      "[383]\ttraining's multi_logloss: 0.613546\tvalid_0's multi_logloss: 1.19307\n",
      "[384]\ttraining's multi_logloss: 0.612603\tvalid_0's multi_logloss: 1.19305\n",
      "[385]\ttraining's multi_logloss: 0.611673\tvalid_0's multi_logloss: 1.19297\n",
      "[386]\ttraining's multi_logloss: 0.610724\tvalid_0's multi_logloss: 1.19294\n",
      "[387]\ttraining's multi_logloss: 0.609775\tvalid_0's multi_logloss: 1.19296\n",
      "[388]\ttraining's multi_logloss: 0.608852\tvalid_0's multi_logloss: 1.193\n",
      "[389]\ttraining's multi_logloss: 0.607891\tvalid_0's multi_logloss: 1.19298\n",
      "[390]\ttraining's multi_logloss: 0.606946\tvalid_0's multi_logloss: 1.19294\n",
      "[391]\ttraining's multi_logloss: 0.606006\tvalid_0's multi_logloss: 1.19286\n",
      "[392]\ttraining's multi_logloss: 0.605058\tvalid_0's multi_logloss: 1.19292\n",
      "[393]\ttraining's multi_logloss: 0.60411\tvalid_0's multi_logloss: 1.19286\n",
      "[394]\ttraining's multi_logloss: 0.603173\tvalid_0's multi_logloss: 1.1928\n",
      "[395]\ttraining's multi_logloss: 0.60225\tvalid_0's multi_logloss: 1.1928\n",
      "[396]\ttraining's multi_logloss: 0.601335\tvalid_0's multi_logloss: 1.19278\n",
      "[397]\ttraining's multi_logloss: 0.600423\tvalid_0's multi_logloss: 1.1928\n",
      "[398]\ttraining's multi_logloss: 0.599507\tvalid_0's multi_logloss: 1.19265\n",
      "[399]\ttraining's multi_logloss: 0.598603\tvalid_0's multi_logloss: 1.19266\n",
      "[400]\ttraining's multi_logloss: 0.597695\tvalid_0's multi_logloss: 1.19265\n",
      "[401]\ttraining's multi_logloss: 0.596816\tvalid_0's multi_logloss: 1.19269\n",
      "[402]\ttraining's multi_logloss: 0.595894\tvalid_0's multi_logloss: 1.19267\n",
      "[403]\ttraining's multi_logloss: 0.594999\tvalid_0's multi_logloss: 1.19256\n",
      "[404]\ttraining's multi_logloss: 0.594073\tvalid_0's multi_logloss: 1.19254\n",
      "[405]\ttraining's multi_logloss: 0.593182\tvalid_0's multi_logloss: 1.19258\n",
      "[406]\ttraining's multi_logloss: 0.592283\tvalid_0's multi_logloss: 1.19267\n",
      "[407]\ttraining's multi_logloss: 0.591385\tvalid_0's multi_logloss: 1.19277\n",
      "[408]\ttraining's multi_logloss: 0.590497\tvalid_0's multi_logloss: 1.19278\n",
      "[409]\ttraining's multi_logloss: 0.5896\tvalid_0's multi_logloss: 1.19279\n",
      "CPU times: user 5h 14min 40s, sys: 34.4 s, total: 5h 15min 14s\n",
      "Wall time: 41min 30s\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "LGBMClassifier(learning_rate=0.05, n_estimators=500)"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%%time\n",
    "#convert label to int\n",
    "\n",
    "import lightgbm as lgb\n",
    "\n",
    "print('Starting training...')\n",
    "# 模型训练\n",
    "gbm = lgb.LGBMClassifier(num_leaves=31,\n",
    "                        learning_rate=0.05,\n",
    "                        n_estimators=500)\n",
    "\n",
    "gbm.fit(X_train, y_train,\n",
    "        eval_set=[(X_test, y_test),(X_train,y_train)], verbose=True, \n",
    "        early_stopping_rounds=5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "6f4302ee",
   "metadata": {},
   "outputs": [],
   "source": [
    "y_score=gbm.predict(X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "a5c41e2a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.7049345417925479"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f1_score(y_test, y_score, average=\"micro\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "797ac93e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.7049345417925479"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "precision_score(y_test, y_score, average=\"micro\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "f73ff3a6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.7049345417925479"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "accuracy_score(y_test, y_score)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "ef2414f2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.7049345417925479"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "recall_score(y_test, y_score, average=\"micro\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b6af0c66",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "conda_python3",
   "language": "python",
   "name": "conda_python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
